﻿using System;
using System.Collections.Generic;
using System.Text;

namespace HAVNet.CoreTesting
{
    struct Digit
    {
        byte _value;

        static Digit()
        { }

        public Digit (byte value)  //constructor
        {
            if (value > 9)
                throw new System.ArgumentException ();

            this._value = value;
        }

        public static explicit operator Digit (byte b)  // explicit byte to digit conversion operator
        {
            return new Digit(b); // explicit conversion
        }
    }

    struct OtroDigit
    {
        byte value;

        public OtroDigit (byte value)  //constructor
        {
            if (value > 9)
                throw new System.ArgumentException ();
            
            this.value = value;
        }

        public static implicit operator byte (OtroDigit d)  // implicit digit to byte conversion operator
        {
            return d.value;  // implicit conversion
        }
    }
}
